package com.example.demofdfs.example.queue;

public class Cosumer implements Runnable {

	public static void main(String[] args) {
		new Thread(new Cosumer()).start();
		new Thread(new Runnable() {
			@Override
			public void run() {
				TaskQueue.add(new Task(44, "444", System.currentTimeMillis()));
				int i = 0;
				while(true) {
					try {
						Thread.sleep(5000L);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					TaskQueue.add(new Task(44, "task" + (++i), System.currentTimeMillis() + 10000L));
				}
			}
		}).start();
	}

	@Override
	public void run() {
		while(true) {
			Task task = TaskQueue.get();
			System.out.println("下发完成..." + task);
		}
	}
}
